home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / actionrp / angband_.5 / angband_ / src / sets.c < prev    next >
C/C++ Source or Header  |  1994-04-02  |  8KB  |  422 lines

  1. /*
  2.  * sets.c: code to emulate the original Pascal sets 
  3.  *
  4.  * Copyright (c) 1989 James E. Wilson 
  5.  *
  6.  * This software may be copied and distributed for educational, research, and
  7.  * not for profit purposes provided that this copyright and statement are
  8.  * included in all such copies. 
  9.  */
  10.  
  11. #include "constant.h"
  12. #include "config.h"
  13. #include "types.h"
  14. #include "externs.h"
  15.  
  16. int 
  17. set_room(element)
  18.     register int        element;
  19. {
  20.     if ((element == DARK_FLOOR) || (element == LIGHT_FLOOR) ||
  21.     (element == NT_DARK_FLOOR) || (element == NT_LIGHT_FLOOR))
  22.     return (TRUE);
  23.     return (FALSE);
  24. }
  25.  
  26. int 
  27. set_corr(element)
  28.     register int        element;
  29. {
  30.     if (element == CORR_FLOOR || element == BLOCKED_FLOOR)
  31.     return (TRUE);
  32.     return (FALSE);
  33. }
  34.  
  35. int 
  36. set_floor(element)
  37.     int                 element;
  38. {
  39.     if (element <= MAX_CAVE_FLOOR)
  40.     return (TRUE);
  41.     else
  42.     return (FALSE);
  43. }
  44.  
  45. int 
  46. set_corrodes(e)               /* changed -CFT */
  47.     inven_type         *e;
  48. {
  49.     int                 element = e->tval;
  50.  
  51.     switch (element) {
  52.       case TV_SWORD:
  53.       case TV_HELM:
  54.       case TV_SHIELD:
  55.       case TV_HARD_ARMOR:
  56.     if ((e->flags2 & TR_ARTIFACT)    /* shouldn't kill artifacts -CFT */
  57.         ||(e->flags & TR_RES_ACID)    /* can't check outside, because flags */
  58.         ||(e->flags2 & TR_IM_ACID))    /* used differently in potions/etc */
  59.         return (FALSE);
  60.     return (TRUE);
  61.       case TV_WAND:
  62.     return (TRUE);
  63.     }
  64.     return (FALSE);
  65. }
  66.  
  67.  
  68. int 
  69. set_flammable(e)           /* changed -CFT */
  70.     inven_type         *e;
  71. {
  72.     int                 element = e->tval;
  73.  
  74.     switch (element) {
  75.       case TV_ARROW:
  76.       case TV_BOW:
  77.       case TV_HAFTED:
  78.       case TV_POLEARM:
  79.       case TV_BOOTS:
  80.       case TV_GLOVES:
  81.       case TV_CLOAK:
  82.       case TV_SOFT_ARMOR:
  83.     if ((e->flags2 & TR_ARTIFACT)    /* shouldn't kill artifacts -CFT */
  84.         ||(e->flags & TR_RES_FIRE)    /* can't check outside, because flags */
  85.         ||(e->flags2 & TR_IM_FIRE))    /* used differently in potions/etc */
  86.         return (FALSE);
  87.     return (TRUE);
  88.       case TV_STAFF:
  89.       case TV_SCROLL1:
  90.       case TV_SCROLL2:
  91.       case TV_FLASK:
  92.       case TV_MAGIC_BOOK:
  93.       case TV_PRAYER_BOOK:
  94.     return (TRUE);
  95.       case TV_LIGHT:
  96.     if (e->subval >= 192)       /* only torches... -CFT */
  97.         return (TRUE);
  98.     else
  99.         return (FALSE);
  100.     }
  101.     return (FALSE);
  102. }
  103.  
  104.  
  105. int 
  106. set_frost_destroy(e)           /* changed -CFT */
  107.     inven_type         *e;
  108. {
  109.     int                 element = e->tval;
  110.  
  111.     if ((element == TV_POTION1) || (element == TV_POTION2)
  112.     || (element == TV_FLASK))
  113.     return (TRUE);
  114.     return (FALSE);
  115. }
  116.  
  117.  
  118. int 
  119. set_meteor_destroy(e)           /* added -DGK */
  120.     inven_type         *e;
  121. {
  122.     int8u               fi, fo;
  123.  
  124.     fi = set_fire_destroy(e);
  125.     fo = set_frost_destroy(e);
  126.     return (fi | fo);
  127. }
  128.  
  129.  
  130. int 
  131. set_mana_destroy(e)           /* added -DGK */
  132.     inven_type         *e;
  133. {                   /* destroy everything but artifacts */
  134.     int                 element = e->tval;
  135.  
  136.     if ((element >= TV_MIN_ENCHANT) && (element <= TV_MAX_WEAR) &&
  137.     (e->flags2 & TR_ARTIFACT))
  138.     return (FALSE);
  139.     return (TRUE);
  140. }
  141.  
  142.  
  143. int 
  144. set_holy_destroy(e)           /* added -DGK */
  145.     inven_type         *e;
  146. {
  147.     int                 element = e->tval;
  148.  
  149.     if ((element >= TV_MIN_ENCHANT) && (element <= TV_MAX_WEAR) &&
  150.     (e->flags & TR_CURSED) && (!(e->flags2 & TR_ARTIFACT)))
  151.     return (TRUE);
  152.     return (FALSE);
  153. }
  154.  
  155.  
  156. int 
  157. set_plasma_destroy(e)           /* added -DGK */
  158.     inven_type         *e;
  159. {
  160.     int8u               fi, li;
  161.  
  162.     fi = set_fire_destroy(e);
  163.     li = set_lightning_destroy(e);
  164.     return (fi | li);
  165. }
  166.  
  167.  
  168. int 
  169. set_acid_affect(e)           /* changed -CFT */
  170.     inven_type         *e;
  171. {
  172.     int                 element = e->tval;
  173.  
  174.     switch (element) {
  175.       case TV_BOLT:
  176.       case TV_ARROW:
  177.       case TV_BOW:
  178.       case TV_HAFTED:
  179.       case TV_POLEARM:
  180.       case TV_BOOTS:
  181.       case TV_GLOVES:
  182.       case TV_CLOAK:
  183.       case TV_SOFT_ARMOR:
  184.     if ((e->flags2 & TR_ARTIFACT)    /* shouldn't kill artifacts -CFT */
  185.         ||(e->flags & TR_RES_ACID)    /* can't check outside, because flags */
  186.         ||(e->flags2 & TR_IM_ACID))    /* used differently in potions/etc */
  187.         return (FALSE);
  188.     return (TRUE);
  189.       case TV_MISC:
  190.       case TV_CHEST:
  191.     return (TRUE);
  192.     }
  193.     return (FALSE);
  194. }
  195.  
  196.  
  197. int 
  198. set_lightning_destroy(e)       /* changed -CFT */
  199.     inven_type         *e;
  200. {
  201.     int                 element = e->tval;
  202.  
  203.     switch (element) {
  204.       case TV_RING:
  205.     if ((e->flags2 & TR_ARTIFACT)    /* shouldn't kill artifacts -CFT */
  206.         ||(e->flags & TR_RES_LIGHT)    /* can't check outside, because flags */
  207.         ||(e->flags2 & TR_IM_LIGHT))    /* used differently in
  208.                          * potions/etc */
  209.         return (FALSE);
  210.     return (TRUE);
  211.       case TV_WAND:
  212.     return (TRUE);
  213.     }
  214.     return (FALSE);
  215. }
  216.  
  217.  
  218. /* ARGSUSED *//* to shut up lint about unused argument */
  219. int 
  220. set_null(e)
  221.     inven_type         *e;
  222. {
  223.     return (FALSE);
  224. }
  225.  
  226.  
  227. int 
  228. set_acid_destroy(e)           /* changed -CFT */
  229.     inven_type         *e;
  230. {
  231.     int                 element = e->tval;
  232.  
  233.     switch (element) {
  234.       case TV_ARROW:
  235.       case TV_BOW:
  236.       case TV_HAFTED:
  237.       case TV_POLEARM:
  238.       case TV_BOOTS:
  239.       case TV_GLOVES:
  240.       case TV_CLOAK:
  241.       case TV_HELM:
  242.       case TV_SHIELD:
  243.       case TV_HARD_ARMOR:
  244.       case TV_SOFT_ARMOR:
  245.     if ((e->flags2 & TR_ARTIFACT)    /* shouldn't kill artifacts -CFT */
  246.         ||(e->flags & TR_RES_ACID)    /* can't check outside, because flags */
  247.         ||(e->flags2 & TR_IM_ACID))    /* used differently in potions/etc */
  248.         return (FALSE);
  249.     return (TRUE);
  250.       case TV_SCROLL1:
  251.       case TV_SCROLL2:
  252.       case TV_FOOD:
  253.       case TV_OPEN_DOOR:
  254.       case TV_CLOSED_DOOR:
  255.       case TV_STAFF:
  256.     return (TRUE);
  257.     }
  258.     return (FALSE);
  259. }
  260.  
  261.  
  262. int 
  263. set_fire_destroy(e)           /* changed -CFT */
  264.     inven_type         *e;
  265. {
  266.     int                 element = e->tval;
  267.  
  268.     switch (element) {
  269.       case TV_ARROW:
  270.       case TV_BOW:
  271.       case TV_HAFTED:
  272.       case TV_POLEARM:
  273.       case TV_BOOTS:
  274.       case TV_GLOVES:
  275.       case TV_CLOAK:
  276.       case TV_SOFT_ARMOR:
  277.     if ((e->flags2 & TR_ARTIFACT)    /* shouldn't kill artifacts -CFT */
  278.         ||(e->flags & TR_RES_FIRE)    /* can't check outside, because flags */
  279.         ||(e->flags2 & TR_IM_FIRE))    /* used differently in potions/etc */
  280.         return (FALSE);
  281.     return (TRUE);
  282.       case TV_STAFF:
  283.       case TV_SCROLL1:
  284.       case TV_SCROLL2:
  285.       case TV_POTION1:
  286.       case TV_POTION2:
  287.       case TV_FLASK:
  288.       case TV_FOOD:
  289.       case TV_OPEN_DOOR:
  290.       case TV_CLOSED_DOOR:
  291.       case TV_MAGIC_BOOK:
  292.       case TV_PRAYER_BOOK:
  293.     return (TRUE);
  294.       case TV_LIGHT:
  295.     if (e->subval >= 192)       /* only torches... -CFT */
  296.         return (TRUE);
  297.     else
  298.         return (FALSE);
  299.     }
  300.     return (FALSE);
  301. }
  302.  
  303.  
  304. int 
  305. general_store(element)
  306.     int                 element;
  307. {
  308.     switch (element) {
  309.       case TV_DIGGING:
  310.       case TV_BOOTS:
  311.       case TV_CLOAK:
  312.       case TV_FOOD:
  313.       case TV_FLASK:
  314.       case TV_LIGHT:
  315.       case TV_SPIKE:
  316.     return (TRUE);
  317.     }
  318.     return (FALSE);
  319. }
  320.  
  321.  
  322. int 
  323. armory(element)
  324.     int                 element;
  325. {
  326.     switch (element) {
  327.       case TV_BOOTS:
  328.       case TV_GLOVES:
  329.       case TV_HELM:
  330.       case TV_SHIELD:
  331.       case TV_HARD_ARMOR:
  332.       case TV_SOFT_ARMOR:
  333.     return (TRUE);
  334.     }
  335.     return (FALSE);
  336. }
  337.  
  338.  
  339. int 
  340. weaponsmith(element)
  341.     int                 element;
  342. {
  343.     switch (element) {
  344.       case TV_SLING_AMMO:
  345.       case TV_BOLT:
  346.       case TV_ARROW:
  347.       case TV_BOW:
  348.       case TV_HAFTED:
  349.       case TV_POLEARM:
  350.       case TV_SWORD:
  351.     return (TRUE);
  352.     }
  353.     return (FALSE);
  354. }
  355.  
  356.  
  357. int 
  358. temple(element)
  359.     int                 element;
  360. {
  361.     switch (element) {
  362.       case TV_HAFTED:
  363.       case TV_SCROLL1:
  364.       case TV_SCROLL2:
  365.       case TV_POTION1:
  366.       case TV_POTION2:
  367.       case TV_PRAYER_BOOK:
  368.     return (TRUE);
  369.     }
  370.     return (FALSE);
  371. }
  372.  
  373.  
  374. int 
  375. alchemist(element)
  376.     int                 element;
  377. {
  378.     switch (element) {
  379.       case TV_SCROLL1:
  380.       case TV_SCROLL2:
  381.       case TV_POTION1:
  382.       case TV_POTION2:
  383.     return (TRUE);
  384.     }
  385.     return (FALSE);
  386. }
  387.  
  388.  
  389. int 
  390. magic_shop(element)
  391.     int                 element;
  392. {
  393.     switch (element) {
  394.       case TV_AMULET:
  395.       case TV_RING:
  396.       case TV_STAFF:
  397.       case TV_WAND:
  398.       case TV_SCROLL1:
  399.       case TV_SCROLL2:
  400.       case TV_POTION1:
  401.       case TV_POTION2:
  402.       case TV_MAGIC_BOOK:
  403.       case TV_ROD:
  404.     return (TRUE);
  405.     }
  406.     return (FALSE);
  407. }
  408.  
  409. int 
  410. blackmarket(element)
  411.     int                 element;
  412. {
  413.     return (TRUE);
  414. }
  415.  
  416. int 
  417. home(element)
  418.     int                 element;
  419. {
  420.     return (TRUE);
  421. }
  422.